Phase 5 item #7: viewer Compare view (side-by-side breakpoints)#14
Merged
Conversation
New "Compare" toolbar button puts mobile (390×844), tablet (768×1024), and desktop (canvas natural width/height) iframes side by side in the viewport area. Each iframe still loads through the per-breakpoint render route added in PR #13, so the reflow is real — not a CSS-scaled snapshot of the desktop layout. Each cell uses CSS `transform: scale()` with --bp-w / --bp-h / --scale variables to fit at ~0.35 scale on a typical viewer width, dropping to 0.28 / 0.22 / 0.18 on narrower viewers via media queries. - `setCompareMode()` puts the .viewport in `compare` class. CSS hides the single #frame and reveals .compare-grid. - `setViewport()` removes the `compare` class so the toggle is mutually exclusive with single-breakpoint modes. - Auto-refresh now goes through a `refreshFrames()` helper that picks the right iframe(s) based on current mode — single frame in normal mode, all three cells in compare mode. - `Fit` button is dimmed (pointer-events: none) in compare mode where it doesn't make sense. - `renderDetailPage` is now exported so the smoke can render it directly without spinning up the HTTP server (which tends to cache stale code across long-running tsx processes). `test-viewer-compare.ts` covers 9 markup checks + 2 runtime checks (initial state has single iframe visible / grid hidden; clicking Compare swaps them and marks the button active). 11/11 pass. All six existing smokes still pass — no regression on PRs #6-13.
This was referenced May 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New
Comparetoolbar button puts mobile (390×844), tablet (768×1024), and desktop (canvas natural width/height) iframes side by side in the viewport area. Each iframe loads through the per-breakpoint render route added in PR #13, so the reflow is real — not a CSS-scaled snapshot of the desktop layout.How it works
setCompareMode()puts the.viewportelement in acompareclass. CSS hides the single#frameand reveals.compare-grid.setViewport()removes thecompareclass so the toggle is mutually exclusive with the single-breakpoint modes.refreshFrames()helper that picks the right iframe(s) based on current mode.transform: scale()with--bp-w/--bp-h/--scalevariables so the iframe renders at the true viewport size but presents at a fraction of that pixel area. Default scale is 0.35 (~960px total at desktop chrome width); media queries drop it to 0.28 / 0.22 / 0.18 on narrower viewers.Fitbutton is dimmed in compare mode where it doesn't apply.renderDetailPageis now exported so the smoke can render it directly without spinning up the HTTP server (which tends to cache stale code across long-runningtsxprocesses — observed today).Test plan
npm run buildcleannpx tsx test-viewer-compare.ts→ 11/11 pass#bp-compareclick: grid visible with 3 cells, single hidden, button marked active)test-fluid-widths,test-default-font,test-root-centering,test-ops-parser,test-guidelines,test-responsive-reflowall still pass — no regression on PRs Phase 5: responsive hint API + renderer mapping (items #1+#2) #6-13Out of scope
canvas_diff— natural follow-ups, kept separate.